<include file="App/Home/View/Public/header.html"/>	
	<div class="col-sm-9 col-sm-offset-3 col-lg-10 col-lg-offset-2 main">			
		<div class="row">
			<ol class="breadcrumb">
				<li class="active position_tit">奖金管理<span style=" padding:0px 5px;">/</span>提现奖金</li>
			</ol>
		</div><!--/.row-->
		
		<div class="row">
			<div class="col-lg-12">
				<div class="panel panel-default">
					<div class="panel-heading">提现 最大限度<span id="max">{$max}</span>最小额度<span id="min">{$min}</span></div>
					<div class="panel-body">
                    <form>
					  <table class="table2 card_input" style=" border-collapse: inherit;">
                            <tbody>
                              <tr>
                                <td class="right1 td1" style=" padding-right:0px;">提现金额：</td>
                                <td class="left1 td2" style=" padding-left: 0px;"><input style=" width:300px;" class="form-control" onBlur="check_money()" id="total"></td>
                                <td class="left1 td3"><span class="red">可用余额<span id="num">{$num}</span>元</span></td>
                              </tr>
                              <tr>
                                <td class="right1 td1" style=" padding-right:0px;">实际到账：</td>
                                <td class="left1 td2" style=" padding-left: 0px;"><input style=" width:300px;" class="form-control" disabled="disabled" value="" id="checkout"></td>
                                <td class="left1 td3"><span>手续费<font id="CounterFee">{$fee}</font>%</span></td>
                              </tr>
                              <tr>
                                <td class="right1 td1" style=" padding-right:0px;">交易密码：</td>
                                <td class="left1 td2" style=" padding-left: 0px;"><input type="password" style=" width:300px;" class="form-control" id="password"></td>
                              </tr>
                              <tr>
							  <span id="bank" style="display:none">{$bank}</span>
							  <span id="cardnum" style="display:none">{$cardnum}</span>
                                <td class="right1 td1" style=" padding-right:0px;">验证码：</td>
                                <td class="left1 td2" style=" padding-left: 0px;"><input style=" width:300px;" class="form-control" Placeholder=""></td>
                                <td class="left1 td3" style=" height:30px; line-height:30px;"><input class="yanzheng_btn" type="button" value="点击发送"></td>
                              </tr>
                            </tbody>
						</table>
                    </form>
                        <div class="panel-footer">
						<div class="input-group article_btn">
							<span class="input-group-btn">
								<a><button onClick="do_withdrawals()"class="btn btn-success btn-md btn_art_return">确认提现</button></a>
							</span>
						</div>
					</div>	
					</div>
				</div>
			</div>
		</div><!--/.row-->
        <div class="row">
			<div class="col-lg-12">
				<div class="panel panel-default">
					<div class="panel-heading">提现记录</div>
					<div class="panel-body">
						<table class="table_all">
						    <thead>
						      <tr>
						        <th class="th_sty">提现订单号</th>
                                <th class="th_sty">提现总金额</th>
                                <th class="th_sty">手续费</th>
                                <th class="th_sty">应到账金额</th>
                                <th class="th_sty">银行</th>
                                <th class="th_sty">银行卡号</th>
                                <th class="th_sty">状态</th>
                                <th class="th_sty">申请时间</th>
						      </tr>
						    </thead>
                            <tbody>
							<foreach name="withdraw" item="vo">
                              <tr>
                                <td>{$vo['order_num']}</td>
                                <td>{$vo['all_money']}</td>
                                <td>{$vo['withdraw_fee']}</td>
                                <td>{$vo['money']}</td>
                                <td>{$vo['bank']}</td>
                                <td>{$vo['card_num']}</td>
                                <td>{$vo['status']|checkout_status=###}</td>
                                <td>{$vo['add_time']}</td>
                              </tr>
							 </foreach>
                            </tbody>
						</table>
                        
					</div>
				</div>
				{$page}
			</div>
		</div><!--/.row-->
	</div>	<!--/.main-->	
<script src="__PUBLIC__/Home/js/jquery-1.7.2.min.js"></script>
<script>
	function check_money(){
		var num = parseFloat($('#num').html());
		var CounterFee = parseFloat($('#CounterFee').html())/100;
		var total = parseFloat($('#total').val());
		var maxs = parseFloat($('#max').html());
		var mins = parseFloat($('#min').html());
		if(isNaN(num)){
			alert("请输入正确的金额");return;
		}
		if(num<total){
			alert("余额不足");return;
		}
		if(total>maxs){
			alert("超过最大限度");return;
		}
		if(total<mins){
			alert("不到最小限度");return;
		}
		var check_out = total*(1-CounterFee);
		if(isNaN(check_out)){
			check_out = 0;
		}
		var checkou_money = $('#checkout').val(check_out);
	}
	function do_withdrawals(){
		var zong_num = $('#total').val();
		var tx_num = $('#checkout').val();
		var pass = $('#password').val();
		var CounterFee = parseFloat($('#CounterFee').html());
		var bank = $('#bank').html();
		var cardnum = $('#cardnum').html();
		var url = "{:U('Pay/do_withdrawals')}";
		$.ajax({
			url:url,
			type:'post',
			data:{'all_money':zong_num,'money':tx_num,'pass':pass,'withdraw_fee':CounterFee,'bank':bank,'card_num':cardnum},
			//async:true,                     //是否同步
	        dataType:'json',                //响应的数据类型
	        success:function(data){         //成功回调函数
	            if(data['status']==1){
					alert(data['info']);
					window.location.href = "{:U('Pay/bank_card')}"
				}else{
					alert(data['info']);
					console.log(data['info']);
				}
	        },
			error:function(){
				alert("请求超时");
			}
		})
		
	}
</script>

</html>

